package br.biofoco.p2p.rpc;

import java.util.HashMap;
import java.util.Map;

import com.google.common.collect.ImmutableMap;

import br.biofoco.p2p.peer.PeerNode;

public class Message {

	private final String command;
	private final PeerNode sender;
	private final PeerNode target;
	private final Map<String,String> params = new HashMap<String,String>();

	public Message(String command, PeerNode from, PeerNode to) {
		this.command = command;
		this.sender = from;
		this.target = to;
	}

	public String getCommand() {
		return command;
	}

	public PeerNode getSender() {
		return sender;
	}

	public PeerNode getTarget() {
		return target;
	}

	public Map<String,String> getParams() {
		return ImmutableMap.copyOf(params);
	}

}
